<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 200px;
            height: 200px;
            background-color: red;
            animation: myAnim 3s 0s infinite;
        }
        /* 鼠标停放动画执行 */
        div:hover {
            background-color: purple;
            /* 鼠标移入动画暂停 */
            animation-play-state: paused;

        }
        /* 定义动画 */
        @keyframes myAnim {
            0% {
                width: 600px;
                height: 600px;
                background-color: red;
            }
            25% {
                width: 300px;
                height: 300px;
                background-color: blue;
            }
            50% {
                width: 200px;
                height: 200px;
                background-color: yellow
            }
            100% {
                width: 50px;
                height: 50px;
                background-color: green;
            }
        }
    </style>
</head>
<body>
<div></div>
</body>
</html>